const path = require('path')
const { CleanWebpackPlugin } = require("clean-webpack-plugin")
const htmlWebpackPlugin = require("html-webpack-plugin")
const webpack = require("webpack")
module.exports = {
    entry: "./src/index.ts",
    mode: "development",
    devtool: "source-map",
    // watch:true,
    output: {
        path: path.resolve(__dirname, 'dist'),
        filename: 'bundle.js',
    },
    module: {
        rules: [
            {
                test: /\.css$/,
                use: [
                    { loader: "style-loader" },
                    {
                        loader: "css-loader",
                        "options": {
                            importLoaders: 1
                        }
                    },
                    { loader: 'postcss-loader' },
                ]
            },
            {
                test: /\.less$/,
                use: [
                    { loader: "style-loader" },
                    { loader: "css-loader", options: { importLoaders: 2 } },
                    { loader: 'postcss-loader' },
                    { loader: "less-loader" }
                ]
            },
            {
                test: /\.jsx?$/g,
                exclude: /(node_modules|bower_components)/,
                loader: "babel-loader",
            },
            {
                test: /\.ts/,
                loader: "babel-loader"
            }
        ]
    },
    plugins: [
        new CleanWebpackPlugin(),
        new htmlWebpackPlugin({
            title: "你好啊",
            template: "./public/index.html",
            "filename": "abc.html"
        }),

    ]
}